#!/bin/sh
######################
#
# It's nesseray that to run caculate_return and top50 before this module 
#
######################
startYear=1994
endYear=2007

FOLDER=return_average
GROUP=top50
IMPORT=sbo.whole.return
EXPORT=sbo.average.return

#function average_return() {
#	java AverageCaculator $1 $2 > $1.${EXPORT}
#}

#mv ../${GROUP}/*.${GROUP} ./
#mv ../${IMPORT}/*.${IMPORT} ./


while [ ${startYear} -le ${endYear} ]
do
	for group in 01 02 03 04 05 06 07 08 09 10
	do
		for type in 20 50 100 200
		do
			java AverageCaculator ${startYear}_${group}.${GROUP} ${type} > ${startYear}_${group}.${type}.${EXPORT}
		done
	done
	let startYear++
done

mv *.${GROUP} ../${GROUP}/
mv *.${IMPORT} ../${IMPORT}/
